home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-02 | 1.8 KB | 72 lines | [TEXT/ToyS] |
- -- define the standard HTTP header
- set LF to ASCII character (10)
- set CR to return
- set CRLF to CR & LF
- set http_10_header to "HTTP/1.0 200 OK" & CRLF & ¬
- "Server: MacHTTP" & CRLF & ¬
- "MIME-Version: 1.0" & CRLF & ¬
- "Content-type: text/html" & CRLF & CRLF
-
- if http_search_args = "" then
-
- -- http_search_args is empty; request input via ISINDEX
- return http_10_header & ¬
- "<html><head>" & ¬
- "<title>Play the Name Game</title><isindex></head>" & ¬
- "<body>" & ¬
- "<H1>Play the Name Game</H1>" & ¬
- "</body></html>"
-
- else
-
- -- get our name
- set theName to word 1 of http_search_args as string
-
- -- initalize some variables for the next routine
- set foundVowel to 0
- set theCounter to 0
- set theSuffix to theName
-
- -- work through the name until we find the first vowel
- repeat until foundVowel is greater than 0
-
- -- increment our counter
- set theCounter to theCounter + 1
-
- -- get the next character
- set theCharacter to the first item of theSuffix
-
- -- check whether or not it is a vowel
- if "aeiouy" contains theCharacter or "AEIOUY" contains theCharacter then
-
- -- found it, exit
- set foundVowel to 1
-
- else
-
- -- left-hand truncate the name
- set theSuffix to items 2 through length of theSuffix as string
- end if
-
- end repeat
-
- -- compose the ryhmes
- set ryhmeOne to "B" & theSuffix
- set ryhmeTwo to "F" & theSuffix
-
- -- return the lyrics
- return http_10_header & ¬
- "<html><head>" & ¬
- "<title>The Name Game</title>" & ¬
- "<body>" & ¬
- "<h1>The Name Game</h1>" & ¬
- "<blockquote>" & theName & ", " & theName & ", Bo " & ryhmeOne & ".<br>" & return & ¬
- "Bananna fana, Fo " & ryhmeTwo & ".<br>" & return & ¬
- "Fe Fi Fo, " & ryhmeTwo & ".<br>" & return & ¬
- "<strong>" & theName & "</strong>!" & ¬
- "</body>" & ¬
- "</html>"
-
- end if
-
-